package Demo13;

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 洪汤泽大帅哥
 * Date: 2024-12-23
 * Time: 10:42
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Set<String> set = new HashSet<>();
        String s = sc.next();
        while (!s.equals("!!!!!")){
            set.add(s);
            s = sc.next();
        }

        TreeSet<String> stringTreeSet = new TreeSet<>(set);

        System.out.println(stringTreeSet.size());
        int n = Math.min(10,stringTreeSet.size());
        for (int i = 0; i < n; i++) {
            System.out.println(stringTreeSet.toArray()[i]);
        }
    }
}
